<?php
	$mode=$_GET['mode'];
	$obj=new Post();
	$obj->PostID=mysql_real_escape_string($_POST['PostID']);
	$obj->NewsTypeID=mysql_real_escape_string($_POST['NewsTypeID']);
	$obj->Title=mysql_real_escape_string($_POST['Title']);
	$obj->Summary=mysql_real_escape_string($_POST['Summary']);
	$obj->Detail=mysql_real_escape_string($_POST['Detail']);
	$obj->TitleEng=($_POST['TitleEng']);
	$obj->SummaryEng=mysql_real_escape_string($_POST['SummaryEng']);
	$obj->DetailEng=mysql_real_escape_string($_POST['DetailEng']);
	$obj->ImageID=mysql_real_escape_string($_POST['imageid']);
	$obj->ImagePath=mysql_real_escape_string($_POST['imagepath']);
	$obj->Source=mysql_real_escape_string($_POST['Source']);
	if($_POST['PostID']=="")
	{
		$obj->insert($conn);
		
	}
	else
	{
		$obj->update($conn);
		
	}
	
	$obj->updateImage($conn);
	$url="?module=post&type=".$obj->NewsTypeID."&page=".$_SESSION['currentpage'];
	echo "<script language='JavaScript'> window.location = '".$url."'</script>";
?>